<?php
namespace EasyVote\EasyVoteBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use EasyVote\EasyVoteBundle\Entity\Classification;

/**
 * Class LoadClassificationData
 * Loads the classifications into the database
 * @package EasyVote\EasyVoteBundle\DataFixtures\ORM
 */
class LoadClassificationData extends AbstractFixture implements OrderedFixtureInterface
{
    /**
     * Loads the classifications into the database
     * @param ObjectManager $manager
     */
    public function load(ObjectManager $manager)
    {
        $freshman = new Classification();
        $freshman->setName("Freshman");
        $manager->persist($freshman);
        $manager->flush();

        $sophomore = new Classification();
        $sophomore->setName("Sophomore");
        $manager->persist($sophomore);
        $manager->flush();

        $junior = new Classification();
        $junior->setName("Junior");
        $manager->persist($junior);
        $manager->flush();

        $senior = new Classification();
        $senior->setName("Senior");
        $manager->persist($senior);
        $manager->flush();

        $grad = new Classification();
        $grad->setName("Graduate Student");
        $manager->persist($grad);
        $manager->flush();

        $faculty = new Classification();
        $faculty->setName("Faculty");
        $manager->persist($faculty);
        $manager->flush();

        $staff = new Classification();
        $staff->setName("Staff");
        $manager->persist($staff);
        $manager->flush();
    }

    /**
     * {@inheritDoc}
     */
    public function getOrder()
    {
        return 7; // the order in which fixtures will be loaded
    }
}

?>
